#ifndef DECODE_H
#define DECODE_H
#include <cstdio>
extern "C" {
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavcodec/avcodec.h>
}
extern "C"
{
#include <libavcodec/avcodec.h>
}

class Decoder{
public:
    Decoder();
    int loop(uint8_t *, int, uint8_t *, int *, int *, int *);
    ~Decoder();
private:
    AVFrame *pFrame;
    AVCodecContext *pCodecCtx = NULL;
    AVCodecParserContext *pCodecParserCtx = NULL;
    AVPacket packet;
    uint8_t *cur_ptr;
    struct SwsContext *img_convert_ctx;
    int got_picture;
    int first_time = 1;
    uint8_t *out_buffer;
    AVFrame *pFrameBGR;
    int size;
};

#endif // DECODE_H
